<template>
  <div class></div>
</template>
<script>
import axios from "@/utils/requestdp";

export default {
  name: "APIcommontianqishishi",
  components: {},
  data() {
    return {};
  },
  computed: {},
  watch: {},
  mounted() {
    this.watchEvent();
  },
  methods: {
    watchEvent() {
      //先清除定时任务
      if (this.$store.state.daping.intervalArr["APIcommontianqishishi"] != undefined) {
        clearInterval(
          this.$store.state.daping.intervalArr["APIcommontianqishishi"][0].interval
        );
      }

      this.loadData();
      let interval = setInterval(() => {
        this.loadData();
      }, this.$root.setting.data.interval);

      this.$store.state.daping.intervalArr["APIcommontianqishishi"] = [
        { interval: interval }
      ];
    },

    loadData() {
      axios.get("/wInfoController/getHourWeather").then(res => {
        this.$store.state.daping.commontianqishishi = res;
      });
    }
  }
};
</script>
<style lang='scss' scoped>
</style>